﻿/*  ----------------------------------------------------------------------------
 *  SysServer
 *  ----------------------------------------------------------------------------
 *  File:       Mediator.cs
 *  Creater:     SEEN\MistSeen
 *  ----------------------------------------------------------------------------
 *  $Date: 2010-09-06 10:36:01 +0000 (Mon, 06 Sep 2010) $
 *  $Rev: 15 $
 *  $Author: ScorDeity $
 *  $URL: http://sysserver.googlecode.com/svn/trunk/src/SysServer/Sock/Mediator.cs $
 *  $Id: Mediator.cs 15 2010-09-06 10:36:01Z ScorDeity $
 */

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Sockets;

namespace SysServer.Sock
{
    public class Mediator
    {
        private IncomingDataPreparer _IncomingDataPreparer;
        private OutputtingDataPreparer _OutputtingDataPreparer;
        private DataEntity _DateEntity;
        private SocketAsyncEventArgs _ReceivSendEventAgr;
        private DataEntityUserToken _ReceivSendToken;
        public Mediator(SocketAsyncEventArgs e)
        {
            this._ReceivSendEventAgr = e;
            this._IncomingDataPreparer = new IncomingDataPreparer(e);
            this._OutputtingDataPreparer = new OutputtingDataPreparer(e);
        }
        public void HandleData(DataEntity incomingDataEntity)
        {
            this._DateEntity = this._IncomingDataPreparer.HandleReceivedData(incomingDataEntity);
        }
        public void PrepareOutData()
        {
            this._OutputtingDataPreparer.PrepareOutputtingData(this._DateEntity);
        }
        public SocketAsyncEventArgs CallBackSocketAsyncEventArg
        {
            get
            {
                return this._ReceivSendEventAgr;
            }
        }

        }
}